package com.pbdevj.ssm.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.pbdevj.ssm.bean.Department;
import com.pbdevj.ssm.service.DepartmentService;
import com.pbdevj.ssm.util.GenerateJsonMessageWithPageHelper;

@Controller
@RequestMapping("/department")
public class DepartmentController
{
	@Autowired
	private DepartmentService departmentService;
	
	@RequestMapping("/departments")
	 @ResponseBody
     public GenerateJsonMessageWithPageHelper getDepartments()
     {
		 List<Department> list = this.departmentService.getDepartments();
		 
    	 return GenerateJsonMessageWithPageHelper.success().add("departments", list);
     }
}
